import { ApiProperty, IntersectionType, PartialType } from '@nestjs/swagger';
import { RoleType } from 'src/common/constant';

class RequiredDto {
  @ApiProperty({
    description: '姓名',
  })
  name: string;

  @ApiProperty({
    description: '邮箱',
  })
  email: string;
}

class PartialDto {
  @ApiProperty({
    description: '年龄',
    minimum: 1,
    maximum: 100,
  })
  age: number;

  @ApiProperty({
    description: '兴趣爱好',
  })
  hobby: string[];

  @ApiProperty({
    description: '描述',
  })
  description: string;

  @ApiProperty({
    description: '电话号码',
  })
  phone: string;
}

/** 新增用户实体 */
export class CreateUserDto extends IntersectionType(
  RequiredDto,
  PartialType(PartialDto),
) {}

/** 用户添加角色 */
export class CreateAssignRolesToUser {
  @ApiProperty({
    description: '用户 id',
  })
  userId: string;

  @ApiProperty({
    description: '角色(可多个) id',
  })
  rolesIds: string[];
}

/** 角色添加权限 */
export class CreateAssignAuthToRole {
  @ApiProperty({
    description: '角色 id',
  })
  roleId: string;

  @ApiProperty({
    description: '权限(可多个) id',
  })
  authIds: string[];
}
